/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.saar.penguin.give2.server.alert;

import de.saar.penguin.give2.server.BigBrother;
import de.saar.penguin.give2.server.Instruction;
import de.saar.penguin.give2.server.SaarNlgSystem;

/**
 *
 * @author koller
 */
public class EnteredWrongRoomAlert extends Alert {
    private final String targetRoom;

    public EnteredWrongRoomAlert(SaarNlgSystem nlg, String targetRoom) {
        super(nlg);
        this.targetRoom = targetRoom;
    }

    @Override
    public boolean isActivated(BigBrother bb) {
        return (playerJustChangedRooms() && !getCurrentRoom().equals(targetRoom));
    }

    @Override
    public Instruction getInstruction() {
        Instruction instr = nlg.instructionGenerator.createInstruction(nlg.visible);
        instr.instructionPhrase = "No, now you are in the wrong room. " + instr.instructionPhrase;
        return instr;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final EnteredWrongRoomAlert other = (EnteredWrongRoomAlert) obj;
        if ((this.targetRoom == null) ? (other.targetRoom != null) : !this.targetRoom.equals(other.targetRoom)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 43 * hash + (this.targetRoom != null ? this.targetRoom.hashCode() : 0);
        return hash;
    }

    
}
